#ifndef ONIONWIDGET_H
#define ONIONWIDGET_H

#include "hsvcolor.h"
#include <QtGui>
#include <cv.h>
#include <highgui.h>


class OnionWidget : public QWidget
{
    Q_OBJECT

public:
    OnionWidget(QWidget *parent);
    void showFrames(QList<QString> filelist);
    void setBackground(QString filename);

public slots:
    void setShowBackground(bool show);
    void setChromaKey(bool show);
    void setMaskColor(HSVColor color);

signals:
    void maskColorChoosen(HSVColor color);

protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);

private:
    void processFrame();

    QImage *m_image;
    IplImage *m_backplane;
    IplImage *m_frame;


    IplImage *m_background;
    IplImage *m_chessboard;
    HSVColor m_maskColor;

    bool m_showBackground;
    bool m_showChromaKey;

};

#endif // ONIONWIDGET_H
